/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package magies;

/**
 *
 * @author Casa
 */
public class calculoAuxiliado {

    public static int funcA(int X, int Y) {
        if (X < Y) {
            return ptAtrib(Y)-ptAtrib(X);
        } else if (X > Y) {
            return ptAtrib(X)-ptAtrib(Y);
        } else {
            return 0;
        }
    }

    public static int funcB(int ptInicial, int pontos,boolean resto){
        int aux = (int)(0.5 + Math.sqrt(0.25+2*(pontos+(ptInicial-1)*ptInicial*0.5)));
        if(resto){
            return pontos - (ptAtrib(aux)-ptAtrib(ptInicial));
        }else{
            return aux;
        }
    }

    public static int ptAtrib(int X){
        return (int)((X - 1) * X * 0.5);
    }

    
}
